<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>我的订单</title>
    <link rel="stylesheet"  href="src/css/base.css?__version=9.4">
    <link rel="stylesheet"  href="src/css/pages.css?__version=9.4">
    <script type="text/javascript" src="src/js/jquery-1.10.1.min.js?__version=9.4"></script>
    <script type="text/javascript" src="src/js/dropload.js?__version=9.4"></script>
    <script type="text/javascript" src="src/js/init.js?__version=9.4"></script>

	<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="/src/js/share.js?23456"></script>
	<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?8ed2efe5b24e14f351f4d88ba2eb3462";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
    <style type="text/css">
    	.fixed-top{height:3.6rem;}
    </style>
</head>
<body>
	<div class="init_content" style="display: none;">
	    <div class="warp myorder_warp" style="top:3.6rem;">
	    	<ul class="myorder_list" id="myorder_list"></ul>
	    </div>
	</div>
    <div class="init_loading">
        <img src="src/img/page_loading.gif?v=1">
    </div>
</body>
<script>
	addheader("我的订单","javascript:history.back(-1);");
	checkUserLogin();
	$(function(){
		fetchData("/OpenAPI/V1/User/orderList",{'token':token,"page":1},function(data){
			var html="";
			var list=data.list;
			console.log(list)
			if(data.total_cnt > 0) {
				for(var i=0;i<data.total_cnt;i++){
					var status=list[i]['state']=='0'?"待处理":list[i]['state']=='1'?"已发货":"已收货";
					var ems_num=list[i]['ems_num']?list[i]['ems_num']:"暂无数据";
					var statusclass=list[i]['state']=='0'?"waring":list[i]['state']=='1'?"success":"success";
					for(var j=0;j<list[i]['toy'].length;j++){
						html+='<li>'
							+'<div class="orderitem">'
							+	'<div class="orderimg"><img src="'+list[i]['toy'][j]['cover']+'"></div>'
							+	'<div class="order_info">'
							+		'<p>'+list[i]['toy'][j]['title']+'</p>'
							+		'<p>x'+list[i]['toy'][j]['count']+'</p>'
							+	'</div>'
							+'</div>'
							+'<div class="orderintro">订单号：'+list[i]['sid']+'</div>'
							+'<div class="orderintro">创建日期：'+list[i]['create_at']+'</div>'
							+'<div class="orderintro">收货人：'+list[i]['name']+' 联系电话：'+list[i]['phone']+'</div>'
							+'<div class="orderintro">收货地址：'+list[i]['region']+list[i]['address']+'</div>'
							+'<div class="orderintro">快递单号：'+ems_num+'</div>'
							+'<label class="orderstatus waring">'+status+'</label>'
							+'</li>';
					}
				}
			} else {
				html="<div class='nulldefault'><img src='src/img/nulldefault.png'><p>暂无数据</p></div>";
			}
			$("#myorder_list").html(html);
		})
	})
</script>
</html>